/* eslint-disable */
const { Controller } = require('egg');

class CommentController extends Controller {
    //新增评论
    async create() {
        const { ctx } = this;
        const { content, user_id, outfit_id, parent_id } = ctx.request.body;
        const result = await ctx.service.review.add(content, user_id, outfit_id, parent_id);
        ctx.success(result, '发表评论成功');
    }

    //删除评论
    async destory(){
        const { ctx } = this;
        const success = ctx.service.comment.remove(ctx.params.id);
        if(success){
            ctx.success(null, '评论删除成功');
        }else{
            ctx.error('评论删除失败');
        }
    }
}
module.exports = CommentController;